﻿//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Logging Application Block
//===============================================================================

using System;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design;
using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.Design.TraceListeners;
using EntLibContrib.Logging.Properties;

namespace EntLibContrib.Logging.Database.Configuration.Design
{
	sealed class LoggingDatabaseCommandRegistrar : CommandRegistrar
	{
		public LoggingDatabaseCommandRegistrar(IServiceProvider serviceProvider)
			: base(serviceProvider) { }

		void AddLoggingDatabaseCommand()
		{
			ConfigurationUICommand cmd = ConfigurationUICommand.CreateMultipleUICommand(ServiceProvider,
																																									InternalResources.ExtendedDatabaseTraceListenerUICommandText,
																																									InternalResources.ExtendedDatabaseTraceListenerUICommandLongText,
																																									new AddLoggingDatabaseCommand(ServiceProvider),
																																									typeof(LoggingDatabaseNode));
			AddUICommand(cmd, typeof(TraceListenerCollectionNode));
		}

		public override void Register()
		{
			AddLoggingDatabaseCommand();
			AddDefaultCommands(typeof(LoggingDatabaseNode));
		}
	}
}
